package com.jrh.dal;

import java.util.List;
import java.util.Map;

import com.jrh.domain.common.Page;
import com.jrh.domain.entity.Apply;

/**
 * 申请DAO
 * 
 * @author yout 2012-8-12 下午1:47:50
 */
public class ApplyDao extends BaseDao<Apply> {

    public ApplyDao(){
        this.namespace = "jrh.single.apply";
    }

    @SuppressWarnings("unchecked")
    public Page<Apply> list(Apply apply, Integer start, Integer pageSize) {
        Map<String, Object> map = this.getPageMap(start, pageSize);
        if (apply != null) {
            map.put("userId", apply.getUserId());
        }
        List<Apply> applys = (List<Apply>) sqlMapClientTemplate.queryForList(namespace + "." + "listByCondition", map);
        Integer count = (Integer) sqlMapClientTemplate.queryForObject(namespace + "." + "listByCondition_count", map);
        return new Page<Apply>(applys, start, pageSize, count);
    }
}
